{template 'common/header'}
<style>
    .card{position:relative; width:400px; max-height:218px; overflow:hidden;}
    .cardsn{position:absolute; color:#666; right:20px; bottom:10px; text-shadow:0 -1px 0 rgba(255, 255, 255, 0.5); font-size:16px;}
    .cardtitle{position:absolute; right:20px; top:10px; color:#ffffff; font-size:16px; text-shadow:0 -1px 0 rgba(255, 255, 255, 0.5);}
    .cardlogo{position:absolute; top:10px; left:20px;}
</style>

<div class="clearfix">
    <!--
      <div class="panel panel-default">


          <div class="panel-heading">
              编辑会员卡
          </div>
          <div class="panel-body">
              <div class="form-group">
                  <label class="col-xs-12 col-sm-3 col-md-2 control-label">卡券名称<span style="color:red">*</span></label>


                  <div class="col-sm-9 col-xs-12">
                      <select name="" class="selector" id="diy_input">
                          <option value="">请选择自定义创建会员卡属性</option>
                          <option value="brand_names">自定义商户名</option>
                          <option value="brand_name">自定义商户名</option>
                      </select>
                  </div>


              </div>
          </div>


    </div>
 !-->
    <form action="" class="form-horizontal form" method="post" enctype="multipart/form-data" id="form1">

        <div class="panel panel-default"  id="input_body">
            <div class="panel-heading">
                会员卡创建
            </div>

            <div class="panel-body">
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">商户名称<span style="color:red">*</span></label>
                    <div class="col-sm-9 col-xs-12">
                        <input required="" type="text" name="brand_name" value="西安贝米商贸" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">卡券名称<span style="color:red">*</span></label>
                    <div class="col-sm-9 col-xs-12">
                        <input required="" type="text" name="title" value="" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">激活方式<span style="color:red">*</span></label>
                   <div class="col-sm-6 col-md-8 col-lg-8 col-xs-12">
                        <select required="" name="create_method" class="form-control">
                            <option value="1" name="create_method" >自动激活</option>
                            <option value="2" name="create_method" >一键激活</option>
                            <option value="3" name="create_method" selected="selected">跳转型一键激活</option>
                            <option value="4" name="create_method" >接口激活</option>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">跳转激活链接<span style="color:red">*</span></label>
                    <div class="col-sm-9 col-xs-12">
                        <input required="" type="text" name="wx_activate_after_submit_url" value="" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">背景图片url<span style="color:red">*</span></label>
                    <div class="col-sm-9 col-xs-12">
                        <!--<input type="text" name="background_pic_url" value="" class="form-control">-->
                        {php echo tpl_form_field_image('background_pic_url');}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">logo图片url<span style="color:red">*</span></label>
                    <div class="col-sm-9 col-xs-12">
                        {php echo tpl_form_field_image('logo_url');}
                        <!--<input type="text" name="logo_url" value="" class="form-control">-->

                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">电话<span style="color:red">*</span></label>
                    <div class="col-sm-9 col-xs-12">
                        <input required="" type="text" name="service_phone" value="" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">会员卡特权说明<span style="color:red">*</span></label>
                    <div class="col-sm-9 col-xs-12">
                        <textarea required="" name="prerogative" value="" class="form-control"></textarea>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">使用须知<span style="color:red">*</span></label>
                    <div class="col-sm-9 col-xs-12">
                        <textarea required="" name="description" value="" class="form-control"></textarea>
                    </div>
                </div>
                <!--
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">等级介绍链接url<span style="color:red">*</span></label>
                    <div class="col-sm-9 col-xs-12">
                        <input type="text" name="custom_field1_url" value="" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">优惠券查看链接url<span style="color:red">*</span></label>
                    <div class="col-sm-9 col-xs-12">
                        <input type="text" name="custom_field2_url" value="" class="form-control">
                    </div>
                </div>
                -->

                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">自定义跳转入口名称<span style="color:red">*</span></label>
                    <div class="col-sm-9 col-xs-12">
                        <input required="" type="text" name="custom_url_name" value="会员中心" class="form-control">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">自定义入口地址链接<span style="color:red">*</span></label>
                    <div class="col-sm-9 col-xs-12">
                        <input required="" type="text" name="custom_url" value="" class="form-control">
                    </div>
                </div>
                <!--
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">自定义2<span style="color:red">*</span></label>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">自定义2名称<span style="color:red">*</span></label>
                    <div class="col-sm-9 col-xs-12">
                        <input type="text" name="custom_cell1_name" value="热门活动" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">自定义2入口地址链接<span style="color:red">*</span></label>
                    <div class="col-sm-9 col-xs-12">
                        <input type="text" name="custom_cell1_url" value="" class="form-control">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">营销场景<span style="color:red">*</span></label>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">营销场景自定义名称<span style="color:red">*</span></label>
                    <div class="col-sm-9 col-xs-12">
                        <input type="text" name="promotion_url_name" value="会员权益" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">营销场景地址链接<span style="color:red">*</span></label>
                    <div class="col-sm-9 col-xs-12">
                        <input type="text" name="promotion_url" value="" class="form-control">
                    </div>
                </div>
                -->
                <!--<div class="form-group">-->
                    <!--<label class="col-xs-12 col-sm-3 col-md-2 control-label">会员卡详情<span style="color:red">*</span></label>-->
                <!--</div>-->
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">会员卡数量<span style="color:red">*</span></label>
                    <div class="col-sm-9 col-xs-12">
                        <input required="" type="text" name="quantity" value="1000" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">每人限领<span style="color:red">*</span></label>
                    <div class="col-sm-9 col-xs-12">
                        <input required="" type="text" name="get_limit" value="15" class="form-control">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
                    <div class="col-sm-9 col-xs-12">
                        <!--{php echo tpl_form_field_image('bgpic', $bgpic);}<br/>-->
                        <button type="submit" class="btn btn-primary col-lg-1" name="submit" value="提交">提交</button>
                        <input type="hidden" name="token" value="{$_W['token']}" />
                    </div>
                </div>
            </div>
        </div>
    </form>


    <script>

        $("#diy_input").change(function () {
            diyInput();
        })

        function diyInput() {

            var hasInput = 0;
            var _selector = $(".selector").find("option:selected").val();
            var t = $('form').serializeArray();

            $.each(t, function() {
                if (this.name == _selector){
                    hasInput = 1;
                };
            });

            if(hasInput != 1){
                var _text = $(".selector").find("option:selected").text();
                var appenInput = '<div class="form-group"><label class="col-xs-12 col-sm-3 col-md-2 control-label">'+_text+'<span style="color:red">*</span></label> <div class="col-sm-9 col-xs-12"> <input required="" type="text" name="'+_selector+'" " class="form-control"> </div> </div>';
                $("#input_body").prepend(appenInput);
            }

        }

    </script>

    {template 'common/footer'}